Skip to main content

🤖 Execute invoice generation workflow

Introduction​

This API allows users to send information via a POST request, and n8n will automatically generate an invoice based on that information. The API processes the content and returns an analysis based on the provided model.

Execute an invoice generation​

Endpoint​

Use the following endpoint to submit the content for invoice generation:

POST https://n8n.japanyosan.com/execute/generate-invoice

Headers​

The API requires the following headers:

  • X-N8N-API-KEY - Your n8n API key for authentication
  • Content-Type: application/json

Request Parameters​

The API expects the following parameters as a JSON payload:

  • model (string) - The AI model to use. Accepted values:
    • ollama
    • gpt-4o
    • gpt-4o-mini
    • gpt-4-turbo
    • gpt-3.5-turbo
    • gemini-1.5-pro
    • gemini-1.5-flash
    • claude-3-5-sonnet-latest
    • claude-3-5-haiku-latest
    • claude-3-opus-latest
  • prompt (string) - The specific prompt to provide for the invoice evaluation.
  • content (string) - The information used to generate the invoice.
  • llmKey (string) - Your API key for the selected model. Not required when using the ollama model.

Example Request​

curl --location 'https://n8n.japanyosan.com/execute/generate-invoice' \
--header 'X-N8N-API-KEY: ey*********' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-4o-mini",
"content": "...",
"llmKey": "sk-proj-ERa23*******",
"prompt": "..."
}'

For Ollama model requests, you can omit the llmKey:

curl --location 'https://n8n.japanyosan.com/execute/generate-invoice' \
--header 'X-N8N-API-KEY: ey*********' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-4o-mini",
"content": "...",
"prompt": "..."
}'

Response​

The response body contains the following two keys:

  • response (string): The result of the invoice generation, which provides the generated invoice based on the provided information.
  • execution_id (integer): A unique identifier for the specific execution of the invoice generation workflow.
{
"response": ".....",
"execution_id": 778
}